﻿using System;

namespace EventBus2
{
    public interface IPublisher<T> where T : IEvent
    {
        /// <summary>
        /// 发布事件
        /// </summary>
        void Pub();
    }

    /// <summary>
    /// 发布者
    /// 
    /// </summary>
    public class PublisherA : IPublisher<EventA>
    {
        /// <summary>
        /// 发布事件
        /// </summary>
        public void Pub()
        {
            //创建事件并发布
            EventBus.Default.Publish(new EventA() { EventName = "我是EventA" }
            , this
            , new MyEventArgsA() { DateTime = DateTime.Now });
        }
    }

}
